<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/inc/taglib.jsp"%>
<link rel="stylesheet" href="${pageContext.request.contextPath}/statics/select/combo.select.css">
<style>
.combo-select{position:absolute;max-width:150px;margin-left: 130px;}
.combo-select .combo-input {height: 18px;}
</style>
<div class="pageContent">
	<form method="post" id="form" enctype="multipart/form-data" action="${pageContext.request.contextPath}${requestScope.record ==null ?'/investment/handover/insert' :'/investment/handover/update' }" class="pageForm required-validate">
		<div class="pageFormContent" layoutH="56">
			<!-- 关闭窗口 -->
			<input type="hidden" name="callbackType" value="closeCurrent" />
			<!-- 隐藏表单 -->
			<c:if test="${requestScope.record !=null}">
				<input type="hidden" name="id" value="${requestScope.record.id}" />
			</c:if>
			<p>
				<label>招商信息</label>
				<select name="imfid">
					<option value="">请选择</option>
					<c:forEach items="${requestScope.investments}" var="item">
						<option value="${item.id }" ${requestScope.record.imfid==item.id ?'selected':''}>${item.phone }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>业主姓名</label> <input name="name" class="required" maxlength="20" type="text" value="${requestScope.record.name}" />
			</p>
			<p>
				<label>年龄</label> <input name="age" class="required digits" maxlength="11" type="text" value="${requestScope.record.age}" />
			</p>
			<p>
				<label>业主性格</label> <input name="cacr" class="required" maxlength="50" type="text" value="${requestScope.record.cacr}" />
			</p>
			<p>
				<label>业主职业</label> <input name="carr" class="required" maxlength="50" type="text" value="${requestScope.record.carr}" />
			</p>
			<p>
				<label>联系电话</label> <input name="phone" class="required" maxlength="11" type="text" value="${requestScope.record.phone}" />
			</p>
			<p>
				<label>QQ</label> <input name="qq" class="required" maxlength="11" type="text" value="${requestScope.record.qq}" />
			</p>
			<p>
				<label>签约时间</label> <input name="sgtm" class="required date" readonly="readonly" datefmt="yyyy-MM-dd" type="text" value="<fmt:formatDate value='${requestScope.record.sgtm}' pattern='yyyy-MM-dd' />" /><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>经营方式</label> <input name="optw" class="required" maxlength="50" type="text" value="${requestScope.record.optw}" />
			</p>
			<p>
				<label>店铺级别</label> <input name="stle" class="required" maxlength="50" type="text" value="${requestScope.record.stle}" />
			</p>
			<p>
				<label>是否有店铺</label> <input name="issp" type="radio" value="0" ${requestScope.record.issp==0?'checked':''} checked />否 <input name="issp" type="radio" value="1" ${requestScope.record.issp==1?'checked':''} />是
			</p>
			<p>
				<label>客户来源</label> <input name="source" class="required" maxlength="100" type="text" value="${requestScope.record.source}" />
			</p>
			<p>
				<label>店铺面积</label> <input id="ftae" class="required number" maxlength="11" type="text" value="${requestScope.record.ftae==null?'':requestScope.record.ftae*0.01}" />
			</p>
			<p>
				<label>有无图纸</label> <input name="isdw" type="radio" value="0" ${requestScope.record.isdw==0?'checked':''} checked />无 <input name="isdw" type="radio" value="1" ${requestScope.record.isdw==1?'checked':''} />有
			</p>
			<p>
				<label>图纸设计日期</label> <input name="dstm" class="required date" readonly="readonly" datefmt="yyyy-MM-dd" type="text" value="<fmt:formatDate value='${requestScope.record.dstm}' pattern='yyyy-MM-dd' />" /><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p>
				<label>预计开业时间</label> <input name="eptm" class="required date" readonly="readonly" datefmt="yyyy-MM-dd" type="text" value="<fmt:formatDate value='${requestScope.record.eptm}' pattern='yyyy-MM-dd' />" /><a class="inputDateButton" href="javascript:;">选择</a>
			</p>
			<p class="nowrap">
				<label>地区</label> <input type="hidden" name="areaName" value="${requestScope.record.areaName}" /> 
				<select class="combox required" name="areaCode" id="investment_combox_province" ref="investment_combox_city" refUrl="${pageContext.request.contextPath}/system/areas/getCityByProvince?id={value}" default-value="110000">
					<c:if test="${requestScope.province==null}">
						<option value="">请选择省份</option>
					</c:if>
					<c:forEach items="${requestScope.provinces}" var="item">
						<option value="${item.id}" ${item.id==requestScope.province?"selected":""}>${item.name}</option>
					</c:forEach>
				</select> <select class="combox required" name="areaCode" id="investment_combox_city" ref="investment_combox_region" refUrl="${pageContext.request.contextPath}/system/areas/getCountyByAreas?id={value}" default-value="110100">
					<c:if test="${requestScope.city==null}">
						<option value="">请选择城市</option>
					</c:if>
					<c:forEach items="${requestScope.citys}" var="item">
						<option value="${item.id}" ${item.id==requestScope.city?"selected":""}>${item.name}</option>
					</c:forEach>
				</select> <select class="combox required" name="areaCode" id="investment_combox_region" default-value="110100">
					<c:if test="${requestScope.county==null}">
						<option value="">请选择市区</option>
					</c:if>
					<c:forEach items="${requestScope.countys}" var="item">
						<option value="${item.id}" ${item.id==requestScope.county?"selected":""}>${item.name}</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>详细地址</label> <input name="addr" class="required" maxlength="100" type="text" value="${requestScope.record.addr}" />
			</p>
			<p>
				<label>招商经理</label> <%-- <input name="imid" class="required" maxlength="50" type="text" value="${requestScope.record.imid}" />  --%>
				<select name="imid" class="combox">
					<option value="">请选择</option>
					<c:forEach items="${requestScope.imidlist}" var="item">
						<option value="${item.employeeId }" ${requestScope.record.imid==item.employeeId ?'selected':''}>${item.employeeName }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>区域经理</label> <%-- <input name="rgid" class="required" maxlength="50" type="text" value="${requestScope.record.rgid}" /> --%>
				<select name="rgid" class="combox">
					<option value="">请选择</option>
					<c:forEach items="${requestScope.rgidlist}" var="item">
						<option value="${item.employeeId }" ${requestScope.record.rgid==item.employeeId?'selected':''}>${item.employeeName }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>运营督导</label> <%-- <input name="opid" class="required" maxlength="50" type="text" value="${requestScope.record.opid}" /> --%>
				<select name="opid" class="combox">
					<option value="">请选择</option>
					<c:forEach items="${requestScope.opidlist}" var="item">
						<option value="${item.employeeId }" ${requestScope.record.opid==item.employeeId?'selected':''}>${item.employeeName }</option>
					</c:forEach>
				</select>
			</p>
			<p>
				<label>合同编号</label> <input name="ctno" class="required" maxlength="50" type="text" value="${requestScope.record.ctno}" />
			</p>
			<p>
				<label>保证金</label> <input id="mrgn" class="required number" maxlength="11" type="text" value="<nf:nfmt num="${requestScope.record.mrgn==null?'':requestScope.record.mrgn}"/>" />
			</p>
			<p>
				<label>报销费用</label> <input id="rbmt" class="required number" maxlength="11" type="text" value="<nf:nfmt num="${requestScope.record.rbmt==null?'':requestScope.record.rbmt}"/>" />
			</p>
			<p>
				<label>管理费</label> <input id="mgmt" class="required number" maxlength="11" type="text" value="<nf:nfmt num="${requestScope.record.mgmt==null?'':requestScope.record.mgmt}"/>" />
			</p>
			<p>
				<label>品牌授权费</label> <input id="auth" class="required number" maxlength="11" type="text" value="<nf:nfmt num="${requestScope.record.auth==null?'':requestScope.record.auth}"/>" />
			</p>
			<p class="nowrap">
				<label>合同附件</label> <%-- <input name="anex" class="required" maxlength="500" type="text" value="${requestScope.record.anex}" /> --%>
				<!-- <label>上传模版：</label> --> <input name="file" type="file" class="valid">
			</p>
			
			<p class="nowrap">
				<label>客户说明</label>
				<textarea name="eptn" cols="150" class="required" maxlength="200">${requestScope.record.eptn}</textarea>
			</p>

			<p class="nowrap">
				<label>人员下派问题</label>
				<textarea name="sdpb" cols="150" class="required" maxlength="200">${requestScope.record.sdpb}</textarea>
			</p>
			<p class="nowrap">
				<label>进货返点服务</label>
				<textarea name="icrs" cols="150" class="required" maxlength="200">${requestScope.record.icrs}</textarea>
			</p>
			<p class="nowrap">
				<label>运费承担问题</label>
				<textarea name="fipb" cols="150" class="required" maxlength="200">${requestScope.record.fipb}</textarea>
			</p>
			<p class="nowrap">
				<label>星配调换问题</label>
				<textarea name="mcpb" cols="150" class="required" maxlength="200">${requestScope.record.mcpb}</textarea>
			</p>
			<p class="nowrap">
				<label>人员培训问题</label>
				<textarea name="tapb" cols="150" class="required" maxlength="200">${requestScope.record.tapb}</textarea>
			</p>
			<p class="nowrap">
				<label>招商促销方案</label>
				<textarea name="pmtn" cols="150" class="required" maxlength="200">${requestScope.record.pmtn}</textarea>
			</p>
			<p class="nowrap">
				<label>合作协议</label>
				<textarea name="cpam" cols="150" class="required" maxlength="500">${requestScope.record.cpam}</textarea>
			</p>
			<%-- <p>
				<label>状态：1-申请移交、2-移交通过、3-移交不通过</label> <input name="state" class="required" maxlength="11" type="text" value="${requestScope.record.state}" />
			</p> --%>

		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script src="${pageContext.request.contextPath}/statics/select/jquery.combo.select.js"></script>
<script type="text/javascript">

	$("[name='imfid']").comboSelect();

	//监听form表单提交事件并且重写
	$("#form", $.pdialog.getCurrent()).submit(function() {
		format();
		return iframeCallback(this, dialogAjaxDone);
	})
	function format() {
		$(".number").each(function() {
			var name = $(this).attr("id");
			var val = $(this).val();
			$("#form", $.pdialog.getCurrent()).append("<input type='hidden' name='" + name + "' value='" + numMulti(val, 100) + "' />");
		});
	}

	$(".combox").change(function() {
		$("ul,li,a").find("[value='all']").remove();
		var province = $("#investment_combox_province").find("option:selected").text();
		var city = $("#investment_combox_city").find("option:selected").text();
		var region = $("#investment_combox_region").find("option:selected").text();
		$("[name='areaName']").val(province + "," + city + "," + region);
	});

	/**
	 * 加法运算，避免数据相加小数点后产生多位数和计算精度损失。
	 *
	 * @param num1加数1 | num2加数2
	 */
	function numAdd(num1, num2) {
		var baseNum, baseNum1, baseNum2;
		try {
			baseNum1 = num1.toString().split(".")[1].length;
		} catch (e) {
			baseNum1 = 0;
		}
		try {
			baseNum2 = num2.toString().split(".")[1].length;
		} catch (e) {
			baseNum2 = 0;
		}
		baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
		return (num1 * baseNum + num2 * baseNum) / baseNum;
	};
	/**
	 * 加法运算，避免数据相减小数点后产生多位数和计算精度损失。
	 *
	 * @param num1被减数  |  num2减数
	 */
	function numSub(num1, num2) {
		var baseNum, baseNum1, baseNum2;
		var precision;// 精度
		try {
			baseNum1 = num1.toString().split(".")[1].length;
		} catch (e) {
			baseNum1 = 0;
		}
		try {
			baseNum2 = num2.toString().split(".")[1].length;
		} catch (e) {
			baseNum2 = 0;
		}
		baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
		precision = (baseNum1 >= baseNum2) ? baseNum1 : baseNum2;
		return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
	};
	/**
	 * 乘法运算，避免数据相乘小数点后产生多位数和计算精度损失。
	 *
	 * @param num1被乘数 | num2乘数
	 */
	function numMulti(num1, num2) {
		var baseNum = 0;
		try {
			baseNum += num1.toString().split(".")[1].length;
		} catch (e) {
		}
		try {
			baseNum += num2.toString().split(".")[1].length;
		} catch (e) {
		}
		return Number(num1.toString().replace(".", "")) * Number(num2.toString().replace(".", "")) / Math.pow(10, baseNum);
	};
	/**
	 * 除法运算，避免数据相除小数点后产生多位数和计算精度损失。
	 *
	 * @param num1被除数 | num2除数
	 */
	function numDiv(num1, num2) {
		var baseNum1 = 0, baseNum2 = 0;
		var baseNum3, baseNum4;
		try {
			baseNum1 = num1.toString().split(".")[1].length;
		} catch (e) {
			baseNum1 = 0;
		}
		try {
			baseNum2 = num2.toString().split(".")[1].length;
		} catch (e) {
			baseNum2 = 0;
		}
		with (Math) {
			baseNum3 = Number(num1.toString().replace(".", ""));
			baseNum4 = Number(num2.toString().replace(".", ""));
			return (baseNum3 / baseNum4) * pow(10, baseNum2 - baseNum1);
		}
	};
</script>